package com.chatcompetition.controller;

import com.chatcompetition.domain.entity.CompetitionActivity;
import com.chatcompetition.service.LifeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/life")
public class LifeController {
    @Autowired
    private LifeService lifeService;

    @GetMapping("/listAll")
    public List<CompetitionActivity> listAllCompetitions() {
        return lifeService.listAll();
    }

    @GetMapping("/listAppAll")
    public List<CompetitionActivity> listAppAllCompetitions() {
        return lifeService.listAll();
    }

    @PostMapping("/save")
    public boolean save(@RequestBody CompetitionActivity activity) {
        return lifeService.save(activity);
    }

    @PutMapping("/update")
    public boolean update(@RequestBody CompetitionActivity activity) {
        return lifeService.update(activity);
    }

    @DeleteMapping("delete/{id}")
    public boolean delete(@PathVariable Long id) {
        return lifeService.delete(id);
    }
}

